﻿-- =============================================
-- Author:		Sandy Stewart
-- Create date: 02/07/2011
-- Description:	Remove links for a particular parliamentarian.
--				Does not delete rows from the ParliamentarianWebLinks
--				table.
-- =============================================
-- Version Date: 29/09/2011, CR06
-- Update for additional editable fields
-- =============================================
CREATE PROCEDURE [dbo].[DeleteParliamentarianLink] 
	@CPALId int
AS
BEGIN
	SET NOCOUNT ON;

	IF (SELECT COUNT(*) FROM ParliamentarianWebLinks WHERE CPALId = @CPALId) > 0
		BEGIN
			-- Update ParliamentarianWebLinks table
			UPDATE ParliamentarianWebLinks
			SET PartyWebsite = null,
				PersonalWebsite = null,
				FacebookAddress = null,
				TwitterAddress = null,
				EmailVisible = null,
				ContactFormVisible = null,
				Link1Label =	null,
				Link1Address = 	null,
				Link2Label = 	null,
				Link2Address =	null,
				Link3Label = 	null,
				Link3Address =	null,
				Link4Label =	null,
				Link4Address = 	null,
				Link5Label =	null,
				Link5Address =	null,
				ElectionMessage =	null,
				FirstSpeechLink =	null,
				ShortURL =			null
			WHERE CPALId = @CPALId
		END	
END